//
//  YRJHotCountryModel.m
//  YanRenjie
//
//  Created by dllo on 15/10/23.
//  Copyright (c) 2015年 yanrenjie. All rights reserved.
//

#import "YRJHotCountryModel.h"

@implementation YRJHotCountryModel
- (void)dealloc {
    [_id release];
    [_cnname release];
    [_enname release];
    [_photo release];
    [_label release];
    [_count release];
    [_flag release];
    
    [super dealloc];
}

- (instancetype)initWithId:(NSNumber *)id cnname:(NSString *)cnname enname:(NSString *)enname photo:(NSString *)photo label:(NSString *)label count:(NSNumber *)count flag:(NSNumber *)flag {
    self = [super init];
    if (self) {
        self.id = id;
        self.cnname = cnname;
        self.enname = enname;
        self.photo = photo;
        self.label = label;
        self.count = count;
        self.flag = flag;
    }
    return self;
}

+ (instancetype)yRJHotCountryModelWithId:(NSNumber *)id cnname:(NSString *)cnname enname:(NSString *)enname photo:(NSString *)photo label:(NSString *)label count:(NSNumber *)count flag:(NSNumber *)flag {
    YRJHotCountryModel *model = [[YRJHotCountryModel alloc] initWithId:id cnname:cnname enname:enname photo:photo label:label count:count flag:flag];
    [model autorelease];
    return model;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    // 对数据进行编码操作
    // 把需要归档的数据进行编码操作, 不需要的就不用写了
    [aCoder encodeObject:self.id forKey:@"id"];
    [aCoder encodeObject:self.cnname forKey:@"cnname"];
    [aCoder encodeObject:self.enname forKey:@"enname"];
    [aCoder encodeObject:self.photo forKey:@"photo"];
    [aCoder encodeObject:self.label forKey:@"label"];
    [aCoder encodeObject:self.count forKey:@"count"];
    [aCoder encodeObject:self.flag forKey:@"flag"];
}

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
        // 解码的操作
        // 把解码后的值再赋值给属性
        self.id = [aDecoder decodeObjectForKey:@"id"];
        self.cnname = [aDecoder decodeObjectForKey:@"cnname"];
        self.enname = [aDecoder decodeObjectForKey:@"enname"];
        self.photo = [aDecoder decodeObjectForKey:@"photo"];
        self.label = [aDecoder decodeObjectForKey:@"label"];
        self.count = [aDecoder decodeObjectForKey:@"count"];
        self.flag = [aDecoder decodeObjectForKey:@"flag"];
    }
    return self;
}
@end
